package com.shan.springweb;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;

/**
 * @Author: ShanYuqing
 * @Version: v1.0
 */
@RestController
public class Controller {
    @RequestMapping("/hello")
    public String simpleParam(HttpServletRequest request) {
        String name = request.getParameter("name");
        String age = request.getParameter("age");
        int i = Integer.parseInt(age);
        System.out.println(name + "--" + age);
        return "ok";

    }

    @RequestMapping("data")
    public String data(@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime dateTime) {
        System.out.println(dateTime);
        return "ok";
    }
}
